<?php
namespace app\common\model;


class RoomBackground extends Base
{
    public function getList($map = []){
        return $this
            ->where($map)
            ->order('sort')
            ->paginate('',false,['query'=>request()->param()]);
    }


    /**
     * Created by xiaosong
     * E-mail:4155433@gmail.com
     *  $id 要查询的id
     *  bool $full 未查询到数据 是否返回默认数据
     */
    public static function getBg($id,$full = true){
        $img =  self::where('bg_id',$id)->cache(3)->field('brief,img,bg_id')->find();
        if (!$img && $full){
            $img = self::order('sort')->cache(3)->field('brief,img,bg_id')->find();
        }
        return $img;
    }
}